package main;


import FileMangerClient.FileMain;
import device.DeviceMain;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.MenuButton;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.Background;
import javafx.scene.layout.BackgroundFill;
import javafx.scene.paint.Color;
import memory.MemoryMain;
import process.ProcessManager;

public class MainUIcontroller {
	ProcessManager processManager =new ProcessManager();
	DeviceMain deviceMain = new DeviceMain();
	MemoryMain MemoryMain = new MemoryMain();
	FileMain FileMain = new FileMain();
    @FXML
    private Button btn4;

    @FXML
    private Button btn5;

    @FXML
    private Button btn2;

    @FXML
    private Button btn3;

    @FXML
    private MenuButton menuBtn;

    @FXML
    private Button btn1;
    
    @FXML
    private AnchorPane pane;
    
    @FXML
    private Label label;
    public void initialize() {
    //	String  Imageurl ="/image/background.jpg";
    	btn1.setBackground(new Background(new BackgroundFill(Color.TRANSPARENT,null,null)));//按钮透明
    	btn2.setBackground(new Background(new BackgroundFill(Color.TRANSPARENT,null,null)));
    	btn3.setBackground(new Background(new BackgroundFill(Color.TRANSPARENT,null,null)));
    	btn4.setBackground(new Background(new BackgroundFill(Color.TRANSPARENT,null,null)));
    	menuBtn.setBackground(new Background(new BackgroundFill(Color.TRANSPARENT,null,null)));
    	pane.setStyle("-fx-background-image:url(/image/background.jpg)");
    	btn1.setGraphic(getIcon("/image/file.png", 130, 110));
    	btn2.setGraphic(getIcon("/image/memory.png", 109, 95));
    	btn3.setGraphic(getIcon("/image/process.png", 109, 100));
    	btn4.setGraphic(getIcon("/image/device.png", 109, 100));
    	menuBtn.setGraphic(getIcon("/image/beigin.png", 40, 35));
    }
    private ImageView getIcon(String iconFileName,int width,int height) {    
        ImageView  icon = new ImageView(new Image(iconFileName));
        icon.setFitWidth(width);
        icon.setFitHeight(height);
        return icon;
    }

    @FXML
    void deviceManage(ActionEvent event) {
    	deviceMain.setprimaryStage();
    }

    @FXML
    void fileManage(ActionEvent event) {
    	FileMain.setprimaryStage();
    	
    }

    @FXML
    void memoryManage(ActionEvent event) {
    	MemoryMain.setprimaryStage();
    }

    @FXML
    void processManage(ActionEvent event) {
    	processManager.setprimaryStage();
    }

}
